package com.dingli.framework.controller;

import com.dingli.framework.util.Response;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalController {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Response<Object> customException(Exception e) {
        e.printStackTrace();
        return new Response<>(-1, e.getMessage());
    }

}
